package sipoc.messaging.component;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.integration.annotation.Header;
import org.springframework.integration.annotation.Router;
import org.springframework.messaging.Message;
import org.springframework.stereotype.Component;

@Component
public class SipocRouter {

	private static final Logger LOGGER = LoggerFactory
			.getLogger(SipocRouter.class);

	@Router(inputChannel = "routerChannel")
	public String route(@Header String countryCode, Message<?> message) {
		LOGGER.info("received message: {}", message);

		if ("SP".equalsIgnoreCase(countryCode)) {
			return "genericManagerChannel";
		}

		return "genericFilterChannel";
	}

}
